﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.Library.Db.DapperHelper
{
    public class DapperExt : SqlServerBaseFixture
    {
        #region 构造函数
        public DapperExt() : base("Data Source=.; Initial Catalog=Fiction; Integrated Security=True;")
        {
            //sa登陆：     
            //"Data Source=DESKTOP-OUBUOP4;Initial Catalog=Fiction;User ID=sa,pwd=;";
            //windows登陆
            //Data Source=DESKTOP-OUBUOP4; Initial Catalog=Fiction; Integrated Security=True
        }

        public DapperExt(string dbconn) : base(dbconn)
        {

        }
        #endregion

        #region 增
        /// <summary>
        /// 新增
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <returns></returns>
        public dynamic Insert<T>(T entity) where T : class
        {
            return Db.Insert<T>(entity);
        }

        /// <summary>
        /// 批量新增
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        public void Insert<T>(List<T> list) where T : class
        {
            Db.Insert<T>(list.ToArray());
        }
        #endregion

        #region 删

        #endregion

        #region 改

        #endregion

        #region 查

        #endregion

    }
}
